﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using DAO;
using DTO;
using System.Data.SqlClient;
namespace BUS
{
    public class TTXacNhanBUS
    {
        public static Boolean InsertDaXacNhan(TTXacNhanDTO tt)
        {           
            return TTXacNhanDAO.InsertDaXacNhan(tt);           
        }

        public static Boolean InsertChiDinh(TTXacNhanDTO tt)
        {
            return TTXacNhanDAO.InsertChiDinh(tt);           
        }
        public static Boolean UpdateChiDinh(TTXacNhanDTO tt)
        {
            return TTXacNhanDAO.UpdateChiDinh(tt);
        }
        public static Boolean DeleteDaXacNhan(string SoHS
                                            , string SoBN)
        {
            return TTXacNhanDAO.DeleteDaXacNhan(SoHS, SoBN);
        }

        public static Boolean UpdateProcess(string SoBn, string SoHS, string SoNhapVien
                                    , string DVuCode, Boolean Process, int nLoaiBN
                                    , SqlConnection conpk, string MaDonVi)
        {
            Boolean kq = true;
            switch (nLoaiBN)
            {
                case 1://ngoai tru -- THUNGAN
                    {
                        kq &= UpdateDataDAO.UpdateBafee(SoBn, DVuCode, Process, conpk, MaDonVi);
                        break;
                    }
                case 2://noi tru -- phkham
                    {
                        kq &= UpdateDataDAO.Updatefeent(SoBn, SoHS, SoNhapVien, DVuCode, Process, conpk, MaDonVi);
                        break;
                    }
                case 3://mien giam -- phkham
                    {
                        kq &= UpdateDataDAO.UpdateMienGiam(SoBn, DVuCode, Process, conpk, MaDonVi);
                        break;
                    }
                case 4://chuong trinh -- phkham
                    {
                        kq &= UpdateDataDAO.UpdateMienGiam(SoBn, DVuCode, Process, conpk, MaDonVi);
                        break;
                    }
                case 5://KSK -- phkham
                    {
                        kq &= UpdateDataDAO.UpdateProcessKSK(SoHS, SoBn, DVuCode, Process, conpk, MaDonVi);
                        break;
                    }
            }
            return kq;
        }
        public static DataTable GetMax(int LoaiSo, int Nam, int Thang)
        {
            return TTXacNhanDAO.GetMax(LoaiSo, Nam, Thang);
        }
        public static Boolean UpdateMax(int Loai, int Nam, int Thang, int Max)
        {
            return TTXacNhanDAO.UpdateMax(Loai, Nam, Thang, Max);
        }
    }
}
